G-Code Simulator This Macro simulates the tool motions in a G-Code file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Items that are needed in the G-Code file are: 1) The only codes that are supported are: X, Y, Z, (Absolute mode only) and T=Tool number G00, G01, G02, G03, I, J, (Arc Center ( Absolute or Incremental values )) G73, G81, G82, G83, G84, G85, G86, G87, G88, G89 Canned Cycles, and R=(Start Z) 2) A comment line at the beginning of each tool with the diameter of the tool. A carat ( ^ ) character is put in front of the decimal value of the diameter of the tool. example: ( 1/2 ^.500 Drill T02 ) Also make sure there is a space after the diameter value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Some other parameters that can be set before running are: 1) IJParameter If your machine is setup to read the I and J arc center as an Incremental value, distance from the start point to the arc center then set IJParameter = 0 If it uses an Absolute value, then set IJParameter = 1 2) Directory$ Set this parameter to the folder where your G-Code files are located. example: Directory$ = "C:\Program Files\Deltacad\nc\" If they are located in several folders then set MultiFolder = 1 and set FolderDefault to your most used folder otherwise set it to "" 3) FileExt$ Set this to the file extension that you use for your G-Code files. examples: FileExt$ = "nc" FileExt$ = "txt" FileExt$ = "gcd" FileExt$ = "" < no extension 4) ViewDefault This sets which view is already selected when the Macro is started. 0=Isometic View 1=Top View 2=Front View 3=Side View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Running the Macro: * All entities will be deleted, so don't run this in a good drawing. * If the parameter MultiFolder = 1 then an 'Option Folders' InputBox to enter a folder name will be shown. The Directory$ parameter and the folder name you enter will be combined for the final folder name. * Selecting the [Cancel] button will find G-Code files in the Main Folder. A 'Get NC File' dialog box will be shown. * Select a file from the list of files. * Select which view you want. * The ReScale (View All) box selects if the Macro will ReScale continously while the Macro is running, otherwise it waits until the end to ReScale. * Select the [Start] button to begin the simulation, otherwise Cancel to end the Macro. When a tool diamter code is found a 'Tool Information' dialog box will be shown. * The tool diameter can be changed to a different diameter. * The Step Program box sets if you want to step this tool one line of G-Code at a time, otherwise the tool will run continuously. * The tool animation speed can be adjusted to 3 different speeds. * The [Tool Animation] button starts the G-Code program with tool motion with tool paths and tool shapes at the end of each line of G-Code. * The [Skip Animation] button will show only tool paths and tool shapes at the end of each line of G-Code. * The [Cancel] button ends the Macro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other notes: * Arcs are made up of multiple lines. (Because I don't know how to make partial ellipses.) * Tool shapes in Front and Sides views are thin squished ellipses so you can see them. * All Drilling cycles G73 G81-G89 are all shown as a simple drill cycle, no pecking or reverse feed. * After using a canned cycle, you can just have Xs and/or Ys for other holes. * The R radius in G02 and G03 is not supported. (Because I didn't know how to program it.) * A layer is created for each tool. * If you re-run the Macro again, you will most likely get a ' Subrountine "dcAddLayer" fails - Layer already exists. ' message. Ignore this message and Click OK. * Other views could be created by using the 'DeltaCad3D.bas' macro, available on the DeltaCad Users Group.org, to find the angles and toolheight (ellipse thickness) and adding it to the parameter section and 'Tool Cut' dialog box. * If your milling machine doesn't accept the carat ( ^ ) character for the tool diameter symbol, another one could be substituted by changing the ToolDiaSym parameter. example: ToolDiaSym = "!" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .